<?php
class AdImage extends Portlet
{
	public $image;
	public $url;
	
	public function init()
	{
		if(!$this->image) {
			$this->image = '/img/nonPic.jpg';
		}
		else{
			$this->image = '/images/ads/'.$this->image;
		}
		$this->htmlOptions = array('class'=>'image');
		parent::init();
	}
	
	protected function renderContent()
	{
		if($this->url) {
			echo CHtml::openTag('a',array('href'=>$this->url));
			echo CHtml::image($this->image,'',array('style'=>'width:160px;height:100px'));
			echo CHtml::image('/img/ad_list/ref.png','',array('class'=>'imageFrame'));
		 	echo CHtml::closeTag('a');
		}else{
			echo CHtml::image($this->image,'',array('style'=>'width:160px;height:100px'));
			echo CHtml::image('/img/ad_list/ref.png','',array('class'=>'imageFrame'));
		}
	}
}
